package StreamDemo.demo1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.IntFunction;

public class test3 {
    public static void main(String[] args){
        ArrayList<String> list = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();
        Collections.addAll(list,"张无忌","张无忌","张无忌","张无忌","张强","张三丰","张翠山","张良","王二麻子","谢广坤");
        Collections.addAll(list2,"张无忌-14","张强-18","张三丰-19","张翠山-20","张良-30","王二麻子-90","谢广坤-20");
        list.stream().skip(3).forEach(name -> System.out.println(name));
        System.out.println("----------------------");
        list.stream().limit(6).skip(3).forEach(name -> System.out.println(name));
        System.out.println("----------------------");
        list.stream().distinct().forEach(name -> System.out.println(name));
        System.out.println("---------------------");
        list2.stream()
            .map(s -> s.split("-")[1]).forEach(s ->System.out.println(s));
        list.stream().toArray(new IntFunction<String[]>() {
            @Override
            public String[] apply(int value){
                return new String[value];
            }
        });
    }   
}
